package com.example.poemtest.category;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AbsListView;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.example.poemtest.R;
import com.example.poemtest.index.dialog.DialogChooseText;

/**
 * created by JHT on 2024/4/7
 */
public class UnlockDynastyDialog extends Dialog {
    private Context context;
    public TextView dialogUserGrade, dialogGrade;
    private Button propUnlock;

//    public UnlockDynastyDialog(Context context, int theme) {
//        super(context, theme);
//    }

    @SuppressLint("ResourceType")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        final UnlockDynastyDialog dialog = new UnlockDynastyDialog(context, R.style.Dialog);
        setContentView(R.layout.dialog_poetry_dynasty);
        dialogGrade = findViewById(R.id.dialog_grade);
        dialogGrade.setText("");
        dialogUserGrade = findViewById(R.id.dialog_user_grade);
        dialogUserGrade.setText("");
        propUnlock = findViewById(R.id.prop_unlock);

        Window dialogWindow = getWindow();
        dialogWindow.setGravity(Gravity.CENTER);
//        dialogWindow.setBackgroundDrawableResource(R.style.Dialog);
        WindowManager.LayoutParams lp = dialogWindow.getAttributes();
        lp.width = AbsListView.LayoutParams.MATCH_PARENT;
        lp.y = 0;//设置Dialog距离底部的距离
        dialogWindow.setAttributes(lp);

    }

    public UnlockDynastyDialog(@NonNull Context context) {
        super(context);
    }
}
